package com.sanri.buildingblock.exportcenter.configs;

import com.dtflys.forest.callback.AddressSource;
import com.dtflys.forest.http.ForestAddress;
import com.dtflys.forest.http.ForestRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.net.URL;

/**
 * @description:
 * @author: huangzhengri
 * @time: 2023-04-17 10:01
 */
@Component
public class EnvAddressSource implements AddressSource {
    @Value("${task.admin.address}")
    private URL address;

    @Override
    public ForestAddress getAddress(ForestRequest forestRequest) {
        ForestAddress forestAddress = new ForestAddress(address.getProtocol(),address.getHost(),address.getPort());
        return forestAddress;
    }
}
